package service.impl;

import service.IPaymentStrategy;

/**
 * 具体策略类：信用卡支付
 */
public class CreditCardStrategy implements IPaymentStrategy {
    private final String cardNumber;
    private final String cvv;

    public CreditCardStrategy(String cardNumber, String cvv) {
        this.cardNumber = cardNumber;
        this.cvv = cvv;
    }
    @Override
    public void pay(double amount) {
        // 模拟调用银行网关的复杂逻辑
        System.out.printf("使用信用卡 [尾号%s] 支付了 ￥%.2f 元，卡片验证值CVV: %s。\n",
                cardNumber.substring(cardNumber.length() - 4), amount, cvv);
    }
}
